package 迭代器;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

/**
 * @author Administrator
 * @ClassName Test
 * @TIME 星期二 2020/12/29
 */
public class Test {
    public static <E> void main(String[] args) {
        Collection<E> collection = new ArrayList<>();
        collection.add((E) "Java YES");
        collection.add((E) "Python YES");
        collection.add((E) "Nvidia YES");
        collection.add((E) String.valueOf(23));
        Object[] objArr = collection.toArray();
        for (int i = 0;i<objArr.length;i++){
            System.out.println(objArr[i]);
        }
        System.out.println("+++++++++++++++++++++");
        Iterator<E> iterator = collection.iterator();
        while(iterator.hasNext()){

            System.out.println(iterator.next());
        }

    }
}
